//
//  KeyWords.m
//  SouthChina
//
//  Created by creator_lq on 15/1/18.
//  Copyright (c) 2015年 科创. All rights reserved.
//

#import "WeatherData.h"

@implementation WeatherData

@synthesize publishDate;
@synthesize nightWeather;
@synthesize dayWeather;
@synthesize lTemp;
@synthesize hTemp;
@synthesize nightWindd;
@synthesize dayWindd;
@synthesize nightWind;
@synthesize dayWind;
@synthesize rise;
@synthesize sunset;
@synthesize wind;
@synthesize weather;
@synthesize temp;
@synthesize windd;
@synthesize city;
@synthesize weatherPic;
-(NSString*)setValue:(NSString*) value
{
    if(value == nil || [value isEqualToString:@""])
    {
        return @"--";
    }
    return value;
}

-(WeatherData*)initWithData:(NSDictionary*) data
{
    self.publishDate = [self setValue:[data objectForKey:@"publishDate"]];
    self.nightWeather = [self setValue:[data objectForKey:@"nightWeather"]];
    self.dayWeather = [self setValue:[data objectForKey:@"dayWeather"]];
    self.lTemp = [self setValue:[data objectForKey:@"lTemp"]];
    self.hTemp = [self setValue:[data objectForKey:@"hTemp"]];
    
    self.nightWindd = [self setValue:[data objectForKey:@"nightWindd"]];
    self.rise = [self setValue:[data objectForKey:@"rise"]];
    self.sunset = [self setValue:[data objectForKey:@"sunset"]];
    self.wind = [self setValue:[data objectForKey:@"wind"]];
    self.weather = [self setValue:[data objectForKey:@"weather"]];
    self.temp = [self setValue:[data objectForKey:@"temp"]];
    self.windd = [self setValue:[data objectForKey:@"windd"]];
    self.city = [self setValue:[data objectForKey:@"city"]];
    self.weatherPic = [self setValue:[data objectForKey:@"weatherPic"]];
    return self;
}

@end
